
(ns ca.uoit.molly.tests.basic-tests
  (:use [ca.uoit.molly.db-molly]
        [ca.uoit.molly.lucene-helper]
        [ca.uoit.molly.lucene-molly]
        [ca.uoit.molly.mycampus :as mycampus]))

(println "Test 1: entity conversions")
(def e1 {:id 1234 :entity "person" :all "ken pu assistant professor"
         :attr (array-map :last "Pu" :first "Ken" :office "UA4012")})
(println (entity-to-doc e1))
(println (doc-to-entity (entity-to-doc e1)))

(println "Test 2: entity crawling")
(defn print-entity [e]
  (do
    (println (format "%s:%s" (:entity e) (:id e)))
    (println (format "\"%s\"" (:all e)))
    (doseq [[k v] (:attr e)]
      (println (format "\t%s: %s" k v)))))

;(for-all-entities
;  mycampus/*db*
;  (mycampus/*entities* :course)
;  print-entity)

(println "Test 3: value crawling")
(for-all-values
  mycampus/*db*
  (mycampus/*entities* :course)
  println)